Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
prosemirror-commands
Advanced tools
The prosemirror-commands package provides a set of predefined commands for manipulating the content of a ProseMirror editor. These commands cover a wide range of common editing actions, such as formatting text, inserting nodes, and manipulating the document structure.
Text Formatting
This feature allows you to toggle text formatting such as bold, italic, and underline. The code sample demonstrates how to create a command to toggle bold formatting using the ProseMirror schema.
const { toggleMark } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');
// Example command to toggle bold formatting
const toggleBold = toggleMark(schema.marks.strong);
Node Insertion
This feature allows you to insert or change the type of nodes in the document. The code sample shows how to create a command to set a block type to a paragraph.
const { setBlockType } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');
// Example command to set a paragraph block type
const setParagraph = setBlockType(schema.nodes.paragraph);
Document Manipulation
This feature provides commands for manipulating the document structure, such as joining blocks or splitting nodes. The code sample demonstrates how to create a command to join the current block with the one above it.
const { joinUp } = require('prosemirror-commands');
// Example command to join the current block with the one above it
const joinWithAbove = joinUp;
Tiptap is a headless, framework-agnostic text editor built on top of ProseMirror. It provides a more modern and flexible API for creating rich text editors. Compared to prosemirror-commands, Tiptap offers a higher-level abstraction and additional features like collaborative editing and real-time collaboration.
Slate is a completely customizable framework for building rich text editors. It provides a more flexible and extensible API compared to prosemirror-commands, allowing developers to define their own commands and behaviors. Slate is known for its ease of use and powerful plugin system.
Draft.js is a rich text editor framework developed by Facebook. It provides a set of immutable models and helper functions for building rich text editors. While it offers similar functionalities to prosemirror-commands, Draft.js is more opinionated and tightly integrated with React.
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This is a core module of ProseMirror. ProseMirror is a well-behaved rich semantic content editor based on contentEditable, with support for collaborative editing and custom document schemas.
This module implements a number of editing commands, which are functions that abstract editing actions which can be bound to keys.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license. There's a forum for general discussion and support requests, and the Github bug tracker is the place to report issues.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
FAQs
Editing commands for ProseMirror
We found that prosemirror-commands demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.